package com.sky.demo.excel;

import com.alibaba.excel.util.StringUtils;
import com.alibaba.excel.write.handler.CellWriteHandler;
import com.alibaba.excel.write.handler.context.CellWriteHandlerContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Cell;

@Slf4j
public class EncryptCellWriteHandler implements CellWriteHandler {

    @Override
    public void afterCellDispose(CellWriteHandlerContext context) {
        Cell cell = context.getCell();
        log.info("第{}行, 第{}列写入完成", cell.getRowIndex(), cell.getColumnIndex());
        if(cell.getRowIndex() > 10 && cell.getColumnIndex() == 1){
            if(StringUtils.isNotBlank(cell.getStringCellValue())){
                cell.setCellValue("$" + cell.getStringCellValue());
            }
        }
    }
}
